package com.itheima.mapper;

import com.itheima.pojo.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper {


    List<User> findByClassId();

    @Update("update ssm_db.user set integral = #{integral}+integral where id = #{id}")
    int addIntegral(@Param("id") Integer id,@Param("integral") Integer integral);

    @Update("update ssm_db.user set ssm_db.user.integral = 0 where ssm_db.user.id in (select t2.user_id from ssm_db.user_class_group t2 where t2.class_id = #{classId})")
    int resetGScoreByGroupId(@Param("classId") Long classId);
}
